#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int DigitSum(int m,int size)
{
	if (size == 1)
		return m;
	else
	{
		m = m % 10;
		return DigitSum(m / 10,size--);
	}
}
int main()
{
	int m = 0;
     int size = 0;
	scanf("%d", &m);
	while (m)
	{
		m = m / 10;
		size++;
	}
	int a=DigitSum(m,size);
	printf("%d", a);
	return 0;
}